stem from R

There is a stem() function in R (as I pointed out in the companion brochure). But the output is not very helpful: not a histogram and not a stem-and-leaf plot due to the truncated nature (a bunch of zeros followed by a count). It also takes a while to load a csv and run it through stem, over 300 seconds or 5 minutes...


In [1]:
start <- proc.time()
taxi <- read.csv('yellow_tripdata_2015-01.csv',header=T)
print(proc.time() - start)


   user  system elapsed 
307.624   1.540 308.351 

In [2]:
start <- proc.time()
stem(taxi$total_amount)
print(proc.time() - start)


  The decimal point is 5 digit(s) to the right of the |

  -0 | 00000000000000000000000000000000000000000000000000000000000000000000+3987
   0 | 00000000000000000000000000000000000000000000000000000000000000000000+12744838
   2 | 
   4 | 
   6 | 
   8 | 
  10 | 
  12 | 
  14 | 
  16 | 
  18 | 
  20 | 
  22 | 
  24 | 
  26 | 
  28 | 
  30 | 
  32 | 
  34 | 
  36 | 
  38 | 5

   user  system elapsed 
  4.284   0.044   4.316 

I have gotten a few requests to bring stemgraphic to R. If I get a customer or a corporation that wants to sponsor this in part, it will happen. At the moment, I do not have enough free time to do this. In the interim, you can use it through %%R magic in Jupyter notebook


In [ ]: